package com.neusoft.movie.v_movies.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.neusoft.movie.v_movies.R;
import com.neusoft.movie.v_movies.adpater.ActivityAdapter;
import com.neusoft.movie.v_movies.javabean.ActivityBean;
import com.neusoft.movie.v_movies.listener.RetrofitListener;
import com.neusoft.movie.v_movies.model.ActivityModel;

import java.util.List;

/**
 * Created by Administrator on 2017/12/25.
 */

public class ActivityFragment extends BaseFragment implements RetrofitListener<List<ActivityBean>> {
        RecyclerView recyclerView;


@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
        setLayout_file(R.layout.mtab04);
        return super.onCreateView(inflater, container, savedInstanceState);
        }

@Override
    void initEvents() {

            }

@Override
    void initViews() {
            recyclerView = (RecyclerView)view.findViewById(R.id.activity_list);
            recyclerView.setLayoutManager(new LinearLayoutManager(this.getActivity()));
            }

@Override
    void initData() {
            ActivityModel activityModel = new ActivityModel();
            activityModel.getActivitylist(this);

            }


@Override
public void onSuccess(List<ActivityBean> activityBeen, int flag) {
        ActivityAdapter adapter = new ActivityAdapter(getActivity(),activityBeen);
        recyclerView.setAdapter(adapter);
        }

@Override
public void onFailed() {

        }

        }
